﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//1.  随机生成100个0 ~1000间的整数，使用Linq语句对这些整数求平方根，对结果从大到小排序，并对结果求和与平均数。
class Program
{
    static void Main(string[] args)
    {
        int i;
        int sum = 0;
        int[] arr = new int[100];
        Random random = new Random();

        for (i = 0; i < arr.Length; i++)
        {
            arr[i] = random.Next(1000);
        }
        int[] arr_sorted = arr.Select(x => x).OrderByDescending(x => x).ToArray();
        for (i = 0; i < arr.Length; i++)
        {
            Console.WriteLine("{0}", arr_sorted[i]);
            sum += arr_sorted[i];
        }
        Console.WriteLine("求和：{0}", sum);
        Console.WriteLine("平均值：{0:0.0000}", (double)sum / 100);
    }
}